package com.example.mysql.controller;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.example.common.core.Result;
import com.example.mysql.entity.TblDataLog;
import com.example.mysql.service.ITblDataLogService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author developer
 * @since 2024-08-18
 */
@RestController
@RequestMapping("/tbl-data-log")
public class TblDataLogController {

    @Resource
    private ITblDataLogService iTblDataLogService;

    @PostMapping
    public Result<Object> add(@RequestBody TblDataLog entity) {
        return Result.success(iTblDataLogService.save(entity));
    }

    @DeleteMapping
    public Result<Object> delete(@RequestBody TblDataLog entity) {
        return Result.success(iTblDataLogService.removeById(entity));
    }

    @PutMapping
    public Result<Object> update(@RequestBody TblDataLog entity) {
        return Result.success(iTblDataLogService.updateById(entity));
    }

    @GetMapping
    public Result<Object> list(TblDataLog entity) {
        return Result.success(iTblDataLogService.list(Wrappers.query(entity)));
    }
}
